home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************/
- /* */
- /* COMPMAC - quick and dirty little macro to compile a macro in the */
- /* current buffer. */
- /* */
- /* Thrown together in a hurry by Marc Adler 8/87 */
- /* */
- /************************************************************************/
-
- #define CTRL_F3 224
-
- init()
- {
- assign_key("compmac", CTRL_F3); /* Invoked by the CTRL F3 key */
- }
-
-
- compmac()
- {
- /* If the macro file was modified since the last write, then save it */
- if (buffer_modified())
- {
- message("buffer modified --- writing file");
- writefile(filename());
- }
-
- /* Call DOS to invoke maccomp on this macro */
- if (os_command(sprintf("maccomp %s > mac$errs", filename())) < 0)
- {
- message("DOS can't invoke the macro compiler");
- get_tty_char();
- return;
- }
-
- /* See if we had errors in the macro by examining the error output */
- old_buf = currbuf();
- errbuf = setcurrbuf(create_buffer("mac$errs"));
- had_an_error = fsearch("error");
- delete_buffer(errbuf);
- setcurrbuf(old_buf);
-
- if (had_an_error)
- {
- message("The macro had errors in it");
- }
- else
- {
- /* Success!!! Load the macro file into the editor */
- loadmacro(filename());
- message("The macro was compiled successfully and is now loaded");
- }
- get_tty_char(); /* make the user press a key to acknowledge */
- }
-